home *** CD-ROM | disk | FTP | other *** search
- #ifndef __SYS_FNCTL_H__
- #define __SYS_FNCTL_H__
-
- /* Copyright (C) 1989 Silicon Graphics, Inc. All rights reserved. */
- /* Copyright (c) 1984 AT&T */
- /* All Rights Reserved */
-
- /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
- /* The copyright notice above does not evidence any */
- /* actual or intended publication of such source code. */
-
- /*#ident "@(#)kern-port:sys/fcntl.h 10.3"*/
- #ident "$Revision: 3.24 $"
-
- #include <sys/types.h>
-
- /* flags for F_GETFL, F_SETFL */
-
- #define FNDELAY 0x04 /* Non-blocking I/O */
- #define FAPPEND 0x08 /* append (writes guaranteed at the end) */
- #define FSYNC 0x10 /* synchronous write option */
- #define FRCACH 0x20 /* Used for file and record locking cache*/
- #define FASYNC 0x40 /* interrupt-driven I/O for sockets */
- #define FNONBLK 0x80 /* POSIX: Non-blocking I/O */
-
- /* open only modes */
-
- #define FCREAT 0x100 /* create if nonexistent */
- #define FTRUNC 0x200 /* truncate to zero length */
- #define FEXCL 0x400 /* error if already created */
- #define FNOCTTY 0x800 /* POSIX: don't make this tty control term */
-
- /* Flag values accessible to open(2) and fcntl(2) */
- /* (The first three can only be set by open) */
- #define O_RDONLY 0
- #define O_WRONLY 1
- #define O_RDWR 2
- #define O_ACCMODE 0x3 /* mask for O_RDONLY, WRONLY, and RDWR */
- #define O_NDELAY FNDELAY
- #define O_APPEND FAPPEND
- #define O_SYNC FSYNC
- #define O_NONBLOCK FNONBLK
-
- /* Flag values accessible only to open(2) */
- #define O_CREAT FCREAT /* open with file create (uses 3rd open arg)*/
- #define O_TRUNC FTRUNC /* open with truncation */
- #define O_EXCL FEXCL /* exclusive open */
- #define O_NOCTTY FNOCTTY /* POSIX: don't assign as controlling tty */
-
- /* fcntl(2) requests */
- #define F_DUPFD 0 /* Duplicate fildes */
- #define F_GETFD 1 /* Get fildes flags */
- #define F_SETFD 2 /* Set fildes flags */
- #define F_GETFL 3 /* Get file flags */
- #define F_SETFL 4 /* Set file flags */
- #define F_GETLK 5 /* Get file lock */
- #define F_SETLK 6 /* Set file lock */
- #define F_SETLKW 7 /* Set file lock and wait */
- #define F_CHKFL 8 /* Check legality of file flag changes */
- #define F_ALLOCSP 10 /* reserved */
- #define F_FREESP 11 /* reserved */
- #define F_SETBSDLK 12 /* Set Berkeley record lock */
- #define F_SETBSDLKW 13 /* Set Berkeley record lock and wait */
- #define F_RGETLK 20 /* Test a remote lock to see if it is blocked */
- #define F_RSETLK 21 /* Set or unlock a remote lock */
- #define F_RSETLKW 22 /* Set or unlock a remote lock and wait */
-
- /* only for sockets */
- #define F_GETOWN 10 /* Get owner */
- #define F_SETOWN 11 /* Set owner */
-
- #if !(defined(_LANGUAGE_C_PLUS_PLUS) && defined(_BSD_COMPAT))
- /* file segment locking set data type - information passed to system by user */
-
- #ifdef _POSIX_SOURCE
- struct flock {
- short l_type;
- short l_whence;
- off_t l_start;
- off_t l_len; /* len = 0 means until end of file */
- pid_t l_pid;
- };
- #else
- struct flock {
- short l_type;
- short l_whence;
- off_t l_start;
- off_t l_len; /* len = 0 means until end of file */
- short l_sysid;
- short l_pid;
- };
- #endif /* ifdef _POSIX_SOURCE */
-
- #endif /* !(C++ && BSD) */
-
- /* file segment locking types */
- /* Read lock */
- #define F_RDLCK 01
- /* Write lock */
- #define F_WRLCK 02
- /* Remove lock(s) */
- #define F_UNLCK 03
- #define FD_CLOEXEC 0x1 /* fcntl 1 in lo bit of arg parameter */
-
- #ifdef sgi /* NOTE: this flag only check for gfx procs */
- /* and is for sgi internal use only */
- #define FD_NODUP_FORK 0x2 /* don't dup this fd on fork (sproc overrides)*/
- #endif
-
- #endif /* !__SYS_FNCTL_H__ */
-